
#pragma once

template <typename T>
class ScopeGuard {
   private:
    const T& _exit_call;

   public:
    ScopeGuard(const T& exit_call) :
        _exit_call(exit_call) {}

    ~ScopeGuard() {
        _exit_call();
    }
};